﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace GandAInvitaciones
{
    public partial class SiteMaster : System.Web.UI.MasterPage
    {
        #region Propiedades
        public string TituloPagina
        {
            get { return LblTituloPagina.Text; }
            set { LblTituloPagina.Text = value; }
        }
        #endregion
        protected void Page_Load(object sender, EventArgs e)
        {
            string strUserAgent = Request.UserAgent.ToString().ToLower();

            if (strUserAgent != null)
            {
                if (Request.Browser.IsMobileDevice == true || strUserAgent.Contains("iphone") ||
                strUserAgent.Contains("blackberry") || strUserAgent.Contains("mobile") ||
                strUserAgent.Contains("windows ce") || strUserAgent.Contains("opera mini") ||
                strUserAgent.Contains("palm"))
                {
                    Response.Redirect("http://m.ganda-invitaciones.com");
                }
            }
        }

        public void alert(string msg)
        {
            if (Page.IsPostBack)
            {
                ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('" + msg + "');", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('" + msg + "');", true);
            }
        }

        public void alert(string msg, string codigoExtra)
        {
            if (Page.IsPostBack)
            {
                ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('" + msg + "');" + codigoExtra, true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('" + msg + "');" + codigoExtra, true);
            }
        }

        public void alertExito()
        {
            alert("Operación exitosa");
        }

        public void alertExito(string codigoExtra)
        {
            alert("Operación exitosa", codigoExtra);
        }

        public void alertSinDatos()
        {
            alert("No se encontraron resultados");
        }

        public void alertSinDatos(string codigoExtra)
        {
            alert("No se encontraron resultados", codigoExtra);
        }
    }
}
